package assignment_cp3120.dataObjects;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Data object to hold the user information
 * Stores name, dob, address, username, password and what type of user they are
 * @author Richard Irons
 */
public class User {
    /**
     * Account types for use with user: user
     */
    public static final String AC_TYPE_USER = "User";
    /**
     * Account types for use with user: manager
     */
    public static final String AC_TYPE_MANAGER = "Manager";
    /**
     * Account types for use with user: admin
     */
    public static final String AC_TYPE_ADMIN = "Admin";
       
    private String firstname;
    private String lastname;
    private String DOB;
    private String address;
    private String suburb;
    private String state;
    private String postcode;    
    private String username;
    private String password;
    private String accountType;
    
    /**
     * Defualt constructor. Set all values to empty string
     */
    public User(){
        firstname = "";
        lastname = "";
        DOB = "";
        address = "";
        suburb = "";
        state = "";
        postcode = "";    
        username = "";
        password = "";
        accountType = "";
    }
    /**
     * Set first name to input value
     * @param firstname
     * this.firstname = firstname
     */
    public void setFirstname(String firstname) {this.firstname = firstname;}
    /**
     * Set last name to input value
     * @param lastname
     * this.lastname = lastname
     */
    public void setLastname(String lastname) {this.lastname = lastname;}
    
    /**
     * Set DOB to input value
     * @param DOB
     * this.DOB = DOB
     */
    public void setDOB(String DOB) {this.DOB = DOB;} 
    
    /**
     * Set address to input value
     * @param address
     * this.address = address
     */
    public void setAddress(String address) {this.address = address;}
    /**
     * Set suburb to input value
     * @param suburb
     * this.suburb = suburb
     */
    public void setSuburb(String suburb) {this.suburb = suburb;}
    /**
     * Set state to input value
     * @param state
     * this.state = state
     */
    public void setState(String state) {this.state = state;}
    /**
     * Set postcode to input value
     * @param postcode
     * this.postcode = postcode
     */
    public void setPostcode(String postcode) {this.postcode = postcode;}
           
    /**
     * Get the firstname
     * @return
     * firstname
     */
    public String getFirstname() {return firstname;}
    /**
     * Get the lastname
     * @return
     * lastname
     */
    public String getLastname() {return lastname;} 
   
    /**
     * Get the DOB
     * @return
     * DOB
     */
    public String getDOB() {return DOB;}
    
    /**
     * Get the address
     * @return
     * address
     */
    public String getAddress() {return address;}
    /**
     * Get the suburb
     * @return
     * suburb
     */
    public String getSuburb() {return suburb;}
    /**
     * Get the state
     * @return
     * state
     */
    public String getState() {return state;}
    /**
     * Get the postcode
     * @return
     * postcode
     */
    public String getPostcode() {return postcode;}
    
    /**
     * Get the username
     * @return
     * username
     */
    public String getUsername(){return username;}

    /**
     * Set the username
     * @param username
     * this.username = username
     */
    public void setUsername(String username){this.username = username;}
    
    /**
     * Get the password
     * @return
     * password
     */
    public String getPassword(){return password;}
    /**
     * Set the password
     * @param password
     * this.password = password
     */
    public void setPassword(String password){this.password = password;}
    
    /**
     * Get the account type
     * @return
     * accountType
     */
    public String getAccountType(){return accountType;}
    
    /**
     * Set the account type
     * @param accountType
     * this.accountType = accountType
     */
    public void setAccountType(String accountType){this.accountType = accountType;}
    
    /**
     * Is the user an admin. If the string is empty then no user has been assigned.
     * @return
     * True if the user is an admin
     */
    public boolean isAdmin(){
        if(accountType.isEmpty())
            return false;
        else
            return accountType.equals(AC_TYPE_ADMIN);
    }
    /**
     * Is the user amanager. If the string is empty then no user has been assigned.
     * @return
     * True if the user is a manager
     */
    public boolean isManager(){
        if(accountType.isEmpty())
            return false;
        else
            return accountType.equals(AC_TYPE_MANAGER);
    }
    /**
     * Is the user an user. If the string is empty then no user has been assigned.
     * @return
     * True if the user is an user
     */
    public boolean isUser(){
        if(accountType.isEmpty())
            return false;
        else
            return accountType.equals(AC_TYPE_USER);
    }
}